import re

# list = re.findall(r"\d+","我的电话号10086,手机号15161,门牌号65646")
# print("findall:",list)
#
# ist = re.finditer(r"\d+","我的电话号10086,手机号15161,门牌号65646")
# for i in ist:
#     print("finditer:",i.group())
#
# st = re.search(r"\d+","我的电话号10086,手机号15161,门牌号65646")
# print("search:",st.group())
#
# t = re.match(r"\d+","我的电话号10086,手机号15161,门牌号65646")
# print("match:",t)

s = """
<div class='zs'><span id='1'>张三</span></div>
<div class='ls'><span id='2'>李四</span></div>
<div class='ww'><span id='3'>王五</span></div>
<div class='zl'><span id='4'>赵六</span></div>
"""

# re.S:让.能匹配换行符
obj = re.compile(r"<div class='.*?'><span id='(?P<id>\d+)'>(?P<wahh>.*?)</span></div>",re.S)
result = obj.finditer(s)
print(obj.search(s).group("wahh"))
for i in result:
    print("------------------")
    print(i.group())
    print(i.group("wahh"))
    print(i.group("id"))